<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">

<head th:replace="_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <!--移动端的展示情况-->
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>博客详情</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
    <link rel="stylesheet" href="../static/css/me.css">
    <link rel="stylesheet" href="../static/css/typo.css">
    <link rel="stylesheet" href="../static/lib/prism/prism.css">
    <link rel="stylesheet" href="../static/css/animate.min.css">
    <link rel="stylesheet" href="../static/lib/tocbot/tobot.css">
<!--    <link rel="stylesheet" href="../static/css/new.css">-->
    <link rel="stylesheet" href="../static/css/writing.css">
    <link rel="stylesheet" href="../static/css/style.css">
</head>


<body>
<div id="particles-js"></div>
    <!--导航-->
    <nav th:replace="_fragments :: menu(1)" class="ui inverted attached segment m-padded-tb-mini navDiv-active">
        <div class="ui teal header">
            <div class="ui inverted secondary stackable menu">
                <h2 class="ui teal header item">Turo</h2>
                <a href="#" class="m-item item m-mobile-hide"><i class="mini home icon"></i>首页</a>
                <a href="#" class="m-item item m-mobile-hide"><i class="mini idea icon"></i>分类</a>
                <a href="#" class="m-item item m-mobile-hide"><i class="mini tags icon"></i>标签</a>
                <a href="#" class="m-item item m-mobile-hide"><i class="mini clone icon"></i>归档</a>
                <a href="#" class="m-item item m-mobile-hide"><i class="mini info icon"></i>关于我</a>
                <div class="right m-item item m-mobile-hide">
                    <div class="ui icon inverted transparent input">
                        <input type="text" placeholder="Search....">
                        <i class="search link icon"></i>
                    </div>
                </div>
            </div>
        </div>
        <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show">
            <i class="sidebar icon"></i>
        </a>
<!--        -->
    </nav>
    <!-- 顶部的图片 -->
    <div class="ui blogImg">
        <img  th:src="@{/img/new6.jpg}"  alt="" class="ui rounded fluid image">
        <div class="ui blogTitle">
            <div class="blogZi new-s">
                <p class="ui center aligned header font-s" >生活，就是心怀最大的善意在荆棘中穿行，</p>
                <p class="ui center aligned header font-s">即使被刺伤，亦不改初衷！</p>
                <p class="ui center aligned header font-s nbsp"> ———高五毛———</p>
            </div>
        </div>
    </div>

    <!--中间部分-->
    <div id="waypoint " class="m-container-small m-padded-tb-big animated pulse ">
        <div class="ui container ">


            <div class="ui attached padded segment ">
                <!-- 内容-->
                <div class="ui right aligned basic segment ">
                    <div class="ui orange basic label " th:text="${blog.flag} ">原创</div>
                </div>

                <h2 class="ui center aligned header " th:text="${blog.title} ">生活不容易，请善待自己！</h2>

                <div class="ui top attached blogBiao">
                    <div class="ui mini horizontal link list blogTi">
                        <div class="item ">
                            <img src="https://unsplash.it/100/100?image=1005 " th:src="@{${blog.user.avatar}} " alt=" " class="ui avatar image ">
                            <div class="content "><a class="header " th:text="${blog.user.nickName} ">turo</a></div>
                        </div>
                        <div class="item ">
                            <i class="calendar icon "></i><span th:text="${#dates.format(blog.updateTime, 'yyyy-MM-dd')} ">2021-4-11</span>
                        </div>
                        <div class="item ">
                            <i class="eye icon "></i><span th:text="${blog.views} ">4244</span>
                        </div>
                    </div>
                </div>

                <br>
                <div id="content " class="typo typo-selection js-toc-content m-padded-lr-responsive m-padded-tb-big " th:utext="${blog.content} ">


                    <!--博客内容-->


                    <!--标签-->
                    <div class="m-padded-lr-responsive ">
                        <a th:href="@{/tags/{id}(id=${tag.id})} " class="ui basic teal left pointing label m-padded-mini m-text-thin " th:each="tag:${blog.tags} " th:text="${tag.name} ">方法论</a>
                    </div>
                    <!--赞赏-->
                    <div th:if="${blog.appreciation} ">
                        <div class="ui center aligned basic segment ">
                            <button id="payButton " class="ui orange basic circular button ">赞赏</button>
                        </div>
                        <div class="ui payQR flowing popup transition hidden ">
                            <div class="ui orange basic label ">
                                <div class="ui images " style="font-size: inherit !important; ">
                                    <div class="image ">
                                        <img src="../static/img/wechat.jpg " th:src="@{/img/wechat.jpg} " alt=" " class="ui rounded bordered image " style="width: 120px; ">
                                        <div>支付宝</div>
                                    </div>
                                    <div class="image ">
                                        <img src="../static/img/wechat.jpg " th:src="@{/img/wechat.jpg} " alt=" " class="ui rounded bordered image " style="width: 120px; ">
                                        <div>微信</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="ui attached positive message " th:if="${blog.shareStatement} ">
                    <!--        &lt;!&ndash;博客信息&ndash;&gt;<a th:href="${/about} " target="_blank ">(联系作者)</a>-->
                    <div class="ui middle aligned grid ">
                        <div class="eleven wide column ">
                            <ui class="list ">
                                <li>作者：<span th:text="${blog.user.nickName} ">高五毛</span><a th:href="@{/about} " target="_blank ">(了解作者)</a> </li>
                                <li>发表时间：<span th:text="${#dates.format(blog.updateTime, 'yyyy-MM-dd HH:mm')} ">2021-4-12 14:21</span></li>
                                <li>版权声明：自由转载-非商用-非衍生-保持署名 (创意共享3.0许可证)</li>
                                <li>公众号转载：请在文末添加作者公众号二维码</li>
                            </ui>
                        </div>
                        <div class="five wide column ">
                            <img src="../static/img/wechat.jpg " th:src="@{/img/wechat.jpg} " alt=" " class="ui right floated rounded bordered image " style="width: 110px; ">
                        </div>
                    </div>
                </div>
                <div class="ui bottom attached segment " th:if="${blog.commentable} ">
                    <!--留言区域列表-->
                    <div id="comment-container " class="ui teal segment ">
                        <div th:fragment="commentList ">
                            <div class="ui threaded comments " style="max-width: 100% ">
                                <h3 class="ui dividing header ">评论</h3>
                                <p style="color: red ">由于后台异常、评论内容暂不显示，但所评论内容仍会归档于数据库</p>
                                <!--/*/<th:block>/*/-->
                                <div class="comment " th:each="comment:${comments} ">
                                    <a class="avatar ">
                                        <img th:src="@{${comment.avatar}} ">
                                    </a>
                                    <div class="content ">
                                        <a class="author ">
                                            <span th:text="${comment.nickName} ">Matt</span>
                                            <div class="ui mini basic teal left pointing label m-padded-mini " th:if="${comment.adminComment} ">博主</div>
                                        </a>
                                        <div class="metadata ">
                                            <span class="date " th:text="${@dates.format(comment.createTime, 'yyyy-MM-dd HH:mm')} ">Today at 5:42PM</span>
                                        </div>
                                        <div class="text " th:text="${comment.content} ">
                                            How artistic!
                                        </div>
                                        <div class="actions ">
                                            <a class="reply " data-commentid="1 " data-commentnickname="Matt " th:attr="data-commentid=${comment.id},data-commentnickname=${comment.nickName} " onclick="reply(this) ">回复</a>
                                        </div>
                                    </div>
                                    <div class="comments " th:if="${#arrays.length(comment.replyComments)}>0">
                                        <div class="comment" th:each="reply:${comment.replyComments}">
                                            <a class="avatar">
                                                <img th:src="@{${reply.avatar}}">
                                            </a>
                                            <div class="content">
                                                <a class="author">
                                                    <span th:text="${reply.nickName}">Matt</span>
                                                    <div class="ui mini basic teal left pointing label m-padded-mini" th:if="${reply.adminComment}">博主</div>
                                                    &nbsp;<span th:text="|@ ${reply.parentComment.nickName}|" class="m-teal">@Peter</span>
                                                </a>
                                                <div class="metadata">
                                                    <span class="date" th:text="${@dates.format(reply.createTime,'yyyy-MM-dd HH:mm')}">Today at 5:42PM</span>
                                                </div>
                                                <div class="text" th:text="${reply.content}">
                                                    How artistic!
                                                </div>
                                                <div class="actions">
                                                    <a class="reply" data-commentid="1" data-commentnickname="Matt" th:attr="data-commentid=${reply.id},data-commentnickname=${reply.nickName}" onclick="reply(this)">回复</a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!--/*/</th:block>/*/-->

                                <!--/*-->
                                <div class="comment">
                                    <a class="avatar">
                                        <img src="https://unsplash.it/100/100?image=1005">
                                    </a>
                                    <div class="content">
                                        <a class="author">Elliot Fu</a>
                                        <div class="metadata">
                                            <span class="date">Yesterday at 12:30AM</span>
                                        </div>
                                        <div class="text">
                                            <p>This has been very useful for my research. Thanks as well!</p>
                                        </div>
                                        <div class="actions">
                                            <a class="reply">回复</a>
                                        </div>
                                    </div>
                                    <div class="comments">
                                        <div class="comment">
                                            <a class="avatar">
                                                <img src="https://unsplash.it/100/100?image=1005">
                                            </a>
                                            <div class="content">
                                                <a class="author">Jenny Hess</a>
                                                <div class="metadata">
                                                    <span class="date">Just now</span>
                                                </div>
                                                <div class="text">
                                                    Elliot you are always so right :)
                                                </div>
                                                <div class="actions">
                                                    <a class="reply">回复</a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="comment">
                                    <a class="avatar">
                                        <img src="https://unsplash.it/100/100?image=1005">
                                    </a>
                                    <div class="content">
                                        <a class="author">Joe Henderson</a>
                                        <div class="metadata">
                                            <span class="date">5 days ago</span>
                                        </div>
                                        <div class="text">
                                            Dude, this is awesome. Thanks so much
                                        </div>
                                        <div class="actions">
                                            <a class="reply">回复</a>
                                        </div>
                                    </div>
                                </div>
                                <!--*/-->

                            </div>
                        </div>
                    </div>
                    <div id="comment-form" class="ui form">
                        <input type="hidden" name="blog.id" th:value="${blog.id}">
                        <input type="hidden" name="parentComment.id" value="-1">
                        <div class="field">
                            <textarea name="content" placeholder="请输入评论信息..."></textarea>
                        </div>
                        <div class="fields">
                            <div class="field m-mobile-wide m-margin-bottom-small">
                                <div class="ui left icon input">
                                    <i class="user icon"></i>
                                    <input type="text" name="nickname" placeholder="姓名" th:value="${session.user}!=null?${session.user.nickName}">
                                </div>
                            </div>
                            <div class="field m-mobile-wide m-margin-bottom-small">
                                <div class="ui left icon input">
                                    <i class="mail icon"></i>
                                    <input type="text" name="email" placeholder="邮箱" th:value="${session.user}!=null?${session.user.email}">
                                </div>
                            </div>
                            <div class="field m-mobile-wide m-margin-bottom-small">
                                <button id="commentpost-btn" type="button" class="ui teal button m-mobile-wide"><i class="edit icon"></i>发布</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div id="toolbar" class="m-padded m-fixed m-right-bottom" style="display: none">
        <div class="ui vertical icon buttons ">
            <button type="button" class="ui toc teal button">目录</button>
            <a href="#comment-container" class="ui teal button">留言</a>
            <button class="ui wechat icon button"><i class="weixin icon"></i></button>
            <div id="toTop-button" class="ui icon button"><i class="chevron up icon"></i></div>
        </div>
    </div>


    <div class="ui top-container flowing popup  transition hidden">
        <ol class="js-toc" style="width: 250px!important;">

        </ol>
    </div>
    <div id="qrcode" class="ui wechat-qr flowing popup transition hidden " style="width: 130px !important;">
        <!--    <img src="../static/img/wechat.jpg" alt="" class="ui rounded image" style="width: 120px !important;">-->
    </div>


    <!--底部footer-->
    <footer th:fragment="footer" class="ui inverted vertical segment m-padded-tb-massive bottom">
        <div class="ui center aligned container bottom-one">
            <div class="ui inverted divided stackable grid " id="bottom-two">
                <div class="three wide column">
                    <div class="ui inverted link list">
                        <div class="item">
                            <img src="../static/img/wechat.jpg" th:src="@{/img/wechat.jpg}" class="ui rounded image" alt="" style="width: 110px">
                        </div>
                    </div>
                </div>
                <div class="three wide column">
                    <h4 class="ui inverted header m-text-spaced m-opacity-mini">学习网站 </h4>
                    <div class="ui inverted link list">
                        <a href="https://github.com/" class="item"><i class="github icon"></i>GitHub</a>
                        <a href="https://www.bilibili.com/" class="item"><i class="bullhorn icon"></i>BiliBili</a>
                        <a href="https://gitee.com/" class="item"><i class="git icon"></i>Gitee</a>
                        <a href="" class="item"><i class="paper plane icon"></i>CSDN</a>
                    </div>
                </div>
                <div class="three wide column">
                    <h4 class="ui inverted header  m-text-spaced m-opacity-mini">联系我</h4>
                    <div class="ui inverted link list">
                        <a href="#" class="item" >Email: none-j@qq.com</a>
                        <a href="#" class="item">QQ: 1521126127</a>
                    </div>
                </div>
                <div class="seven wide column">
                    <h4 class="ui inverted header  m-text-spaced m-opacity-mini">Turo</h4>
                    <p class="m-text-thin m-text-spaced m-opacity-mini">这是我的个人博客、会分享关于编程、写作、学习、思考相关的任何内容，希望可以给来到这的人有所帮助……</p>
                </div>
            </div>
            <div class="ui inverted section divider "></div>
            <div>
                <div class="m-text-thin m-text-spaced m-opacity-tiny" id="time"></div>
                <p class="m-text-thin m-text-spaced m-opacity-tiny">Copyright @2021-2022 Turo Designed by Turo</p>
            </div>
        </div>
    </footer>

    <!--/*/<th:block th:replace="_fragments :: script">/*/-->
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/jquery.scrollto@2.1.3/jquery.scrollTo.min.js"></script>
    <script src="../static/lib/prism/prism.js"></script>
    <script src="../static/lib/tocbot/tocbot.min.js"></script>
    <script src="../static/lib/qrcode/qrcode.min.js"></script>
    <script src="../static/lib/waypoints/jquery.waypoints.min.js"></script>
    <script src="../static/lib/js/writing.js"></script>
    <script src="../static/lib/js/particles.min.js"></script>
    <script src="../static/lib/js/app.js"></script>
    <!--/*/</th:block>/*/-->

    <script th:inline="javascript">
        $('.menu.toggle').click(function() {
            $('.m-item').toggleClass('m-mobile-hide');
        });
        $('#payButton').popup({
            popup: $('.payQR.popup'),
            on: 'click',
            position: 'bottom center'
        });

        tocbot.init({
            // Where to render the table of contents.
            tocSelector: '.js-toc',
            // Where to grab the headings to build the table of contents.
            contentSelector: '.js-toc-content',
            // Which headings to grab inside of the contentSelector element.
            headingSelector: 'h1, h2, h3',
        });

        $('.toc.button').popup({
            popup: $('.top-container.popup'),
            on: 'click',
            position: 'left center'
        });

        $('.wechat').popup({
            popup: $('.wechat-qr'),
            on: 'hover',
            position: 'left center'
        });
        /*qrcode是指定的一个ID*/
        var serurl = /*[[#{blog.serurl}]]*/ "https://www.turo.me";
        var url = /*[[@{/blog/{id}(id=${blog.id})}]]*/ "";
        var qrcode = new QRCode("qrcode", {
            text: serurl + url,
            width: 110,
            height: 110,
            colorDark: "#000000",
            colorLight: "#ffffff",
            correctLevel: QRCode.CorrectLevel.H
        });

        $('#toTop-button').click(function() {
            $(window).scrollTo(0, 500);
        });

        var waypoint = new Waypoint({
            element: document.getElementById('waypoint'),
            handler: function(direction) {
                if (direction == 'down') {
                    $('#toolbar').show(100);
                } else {
                    $('#toolbar').hide(500);
                }
                console.log('Scrolled to waypoint!  ' + direction);
            }
        })

        //评论表单验证
        $('.ui.form').form({
            fields: {
                title: {
                    identifier: 'content',
                    rules: [{
                        type: 'empty',
                        prompt: '请输入评论内容'
                    }]
                },
                content: {
                    identifier: 'nickname',
                    rules: [{
                        type: 'empty',
                        prompt: '请输入你的大名'
                    }]
                },
                type: {
                    identifier: 'email',
                    rules: [{
                        type: 'email',
                        prompt: '请填写正确的邮箱地址'
                    }]
                }
            }
        });

        $(function() {
            $("#comment-container").load( /*[[@{/comments/{id}(id=${blog.id})}]]*/ "comments/6");
        });

        $('#commentpost-btn').click(function() {
            var boo = $('.ui.form').form('validate form');
            if (boo) {
                console.log('校验成功');
                postDate();
            } else {
                console.log('校验失败');
            }

        });

        function postDate() {
            $("#comment-container").load( /*[[@{/comments}]]*/ "", {
                "parentComment.id": $("[name='parentComment.id']").val(),
                "blog.id": $("[name='blog.id']").val(),
                "nickName": $("[name='nickname']").val(),
                "email": $("[name='email']").val(),
                "content": $("[name='content']").val()
            }, function(responseTxt, statusTet, xhr) {
                // $(window).scrollTo($('#comment-container'),500);
                clearContent();
            });
        }


        function clearContent() {
            $("[name='content']").val('');
            $("[name='parentComment.id']").val(-1);
            $("[name='content']").attr("placeholder", "请输入评论信息.....");
        }

        function reply(obj) {
            var commentId = $(obj).data('commentid');
            var commentNickname = $(obj).data('commentnickname');
            $("[name='content']").attr("placeholder", "@" + commentNickname).focus();
            $("[name='parentComment.id']").val(commentId);
            $(window).scrollTo($('#comment-form'), 500);
        }
    </script>
</body>

</html>